<template>
  <div class="count-view">
    <button @click="count--">-</button>
    <p>{{ count }}</p>
    <button @click="count++">+</button>
  </div>
</template>

<script>
export default {
  name: "CounterView",
  data() {
    return {
      count: 0,
    };
  },
  created() {
    console.log("CounterView - 初始化完成");
  },
  beforeDestroy() {
    console.log("CounterView - 组件销毁");
  },
  activated() {
    console.log("CounterView - activated");
  },
  deactivated() {
    console.log("CounterView - deactivated");
  },
};
</script>

<style lang="scss" scoped>
.count-view {
  width: 120px;
  margin: 0 auto;
}
button {
  width: 120px;
  height: 30px;
}
p {
  margin: 10px 0;
  text-align: center;
}
</style>